<template>
  <div id="home">
    <Header />
    <Swiper />
    <Icon />
    <Recommend />
  </div>
</template>

<script>
import Header from "./components/Header";
import Swiper from "./components/Swiper";
import Icon from "./components/Icon";
import Recommend from "./components/Recommend";
import axios from "axios";

export default {
  name: "Home",
  data() {
    return {
      city: "",
      swiperList: [],
      iconList: [],
      recommendList: [],
      weekendList: [],
    };
  },
  components: {
    Header,
    Swiper,
    Icon,
    Recommend,
  },
  methods: {
    getHomeInfo() {
      axios.get("/static/mock/index.json").then(this.getHomeInfoSucc);
    },
    getHomeInfoSucc(res) {
      res = res.data;
      console.log(res.data);
      if (res.ret && res.data) {
        const data = res.data;
        this.city = data.city;
        this.swiperList = data.swiperList;
        this.iconList = data.iconList;
        this.recommendList = data.recommendList;
        this.weekendList = data.weekendList;
      }
    },
  },
  mounted() {
    this.getHomeInfo();
  },
};
</script>

<style>
* {
  margin: 0;
  padding: 0;
  font-size: 16px;
}
</style>
